<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>微信推送消息日志</title>
    <%@include file="/WEB-INF/layouts/index-header.jsp"%>
</head>
<body>

<div class="tpanel">
    <div class="panel-content">
        <div class="container-fluid">
            <div id="tool">
                <form id="searchForm" class="form-inline" onsubmit="return search('#searchForm','#table')" style="margin-top:20px;margin-bottom:20px;">
                    <div class="form-group">
                        <input class="form-control tcsf-datetimepicker" id="startTime" name="startTime" /> 至
                        <input class="form-control tcsf-datetimepicker" id="endTime" name="endTime" />
                         状态：
                        <select class="form-control" id="state" name="state">
                            <option value="all">全部</option>
                            <option value="true">成功</option>
                            <option value="false">失败</option>
                        </select>
                        <button type="submit" class="btn btn-primary">查询</button>
                    </div>
                </form>
            </div>
            <table id="table"></table>
        </div>
    </div>
</div>

<script type="text/javascript">
    changeTitle('微信推送消息日志');

    $(function() {
        $('.form_datetime').datetimepicker({
            language : 'zh-CN',
            autoclose : true
        });
        $('#table').bootstrapTable({
            url: '${ctx}/admin/wechat/push-log/page-list?search_EQL_wechatMpId=${currentWechatMpId}&order=desc&sort=created_time',
            idField : 'id',
            striped : true,
            pagination : true,
            pageNumber : 1,
            pageSize : 25,
            sidePagination : 'server',
            uniqueId : 'id',
            /*checkbox : true,
            clickToSelect : true,*/
            queryParams : queryParams,
            responseHandler : responseHandler,
            columns: [/*{
                field: 'ck',
                checkbox : true
            },*/
                {
                    title : '#',
                    width : 50,
                    align : 'center',
                    valign :'middle',
                    formatter : snFormatter
                },
                {
                    field : 'toUser',
                    title : '发送给',
                    valign :'middle',
                    align : 'center'
                },
                {
                    field : 'content',
                    title : '内容',
                    valign :'middle',
                    align : 'center'
                },{
                    field : 'time',
                    title : '时间',
                    valign :'middle',
                    align : 'center'
                },{
                    field : 'reason',
                    title : '原因',
                    valign : 'middle',
                    align : 'center',
                    formatter : function (value, row, index) {
                        if (value != "") {
                            return '<span class="label label-danger">' + value + '</span>';
                        }
                    }
                },
                {
                    field : 'state',
                    title : '状态',
                    valign :'middle',
                    align : 'center',
                    formatter : function(value, row, index) {
                        var content = "";
                        if(value == "True") {
                            content = '<span class="label label-success">成功</span>'
                        } else {
                            content = '<span class="label label-danger">失败</span>';
                        }
                        return content;
                    }
                },
                {
                    field: 'op',
                    searchable: true,
                    title: '操作',
                    valign: 'middle',
                    align: 'center',
                    formatter: operateFormatter
                }
            ]
        });

    });

    function operateFormatter(value,row,index) {
        var content = '<a title="查看详情" href="javascript:detail(' + row.id + ')"><i class="iconfont icon-caidanguanli"></i></a>';
        content += '&nbsp;&nbsp;&nbsp;&nbsp;';
        <%--content += '<a href="${ctx}/admin/wechat/push-log/update?id=' + row.id + '" title="编辑"><i class="iconfont icon-iconfontcolor32"></i></a>';--%>
        <%--content += '&nbsp;&nbsp;&nbsp;&nbsp;';--%>
        content += '<a href="javascript:del(' + row.id + ')" title="删除"><i class="iconfont icon-shanchu"></i></a>';
        return content;
    }
    function detail(id) {
        openWindow('查看详情','${ctx}/admin/wechat/push-log/detail?id=' + id);
    }
    function del(id,name) {
        carefulDelete('${ctx}/admin/wechat/push-log/careful-delete',id,'请输入您的管理密码以确定删除此系统资源');
    }
</script>

</body>
</html>
